package com.huawei.M01.iterator.May09;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Smallest {
    public int smallestRepunitDivByK(int k) {
        if (k % 2 == 0 || k % 5 == 0) {
            return -1;
        }

        int redis = 1 % k;
        int length = 1;
        while (redis != 0) {
            redis = (redis * 10 + 1) % k;
            length++;
        }
        return length;
    }

    public static void main(String[] args) {
        System.out.println(new Smallest().smallestRepunitDivByK(17));
    }
}
